//
//  BasicTableViewController.swift
//  weibo
//
//  Created by nick on 15/9/23.
//  Copyright © 2015年 cn.nick. All rights reserved.
//

import UIKit

class BasicTableViewController: UITableViewController {

    var logon = UserAccountViewModel.userAccountViewModel.userLogon
    var vistorView: VisitorView?
    override func loadView() {
        logon ? super.loadView() : setUpVisitorView()
    }
    
    func setUpVisitorView() {
        // 实例化
        vistorView = VisitorView()
        // 赋值
        view = vistorView
        vistorView?.registerBtn.addTarget(self, action: "regiseter", forControlEvents: UIControlEvents.TouchUpInside)
        vistorView?.loginBtn.addTarget(self, action: "login", forControlEvents: UIControlEvents.TouchUpInside)
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "regiseter")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "login")
        
    }
    func regiseter() {
        print("注册")
    }
    func login() {
        print("登录")
        let loginVC = OauthViewController()
        let nav = UINavigationController(rootViewController: loginVC)
        presentViewController(nav, animated: true, completion: nil)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }

    

}
